package models

import (
	"gorm.io/gorm"
	"time"
)

// OrderAcceptance 订单接单记录表
type OrderAcceptance struct {
	ID           uint64         `gorm:"primaryKey;autoIncrement;comment:主键ID" json:"id"`
	OrderID      uint64         `gorm:"not null;index;comment:订单ID" json:"order_id"`
	OrderNo      string         `gorm:"type:varchar(32);not null;index;comment:订单号" json:"order_no"`
	OperatorID   string         `gorm:"type:varchar(64);not null;index;comment:操作员ID" json:"operator_id"`
	OperatorType string         `gorm:"type:varchar(20);not null;comment:操作员类型(agent-代理商,landlord-房东,admin-管理员)" json:"operator_type"`
	OperatorName string         `gorm:"type:varchar(100);comment:操作员姓名" json:"operator_name"`
	Action       string         `gorm:"type:varchar(20);not null;comment:操作类型(accept-接单,reject-拒绝,assign-分配)" json:"action"`
	Reason       string         `gorm:"type:text;comment:操作原因" json:"reason"`
	Status       int8           `gorm:"type:tinyint;default:1;comment:状态(1-成功,2-失败,3-已撤销)" json:"status"`
	ProcessedAt  time.Time      `gorm:"type:timestamp;not null;comment:处理时间" json:"processed_at"`
	ResponseTime int64          `gorm:"comment:响应时间(毫秒)" json:"response_time"`
	CreatedAt    time.Time      `gorm:"autoCreateTime;index;comment:创建时间" json:"created_at"`
	UpdatedAt    time.Time      `gorm:"autoUpdateTime;comment:更新时间" json:"updated_at"`
	DeletedAt    gorm.DeletedAt `gorm:"index;comment:软删除时间" json:"deleted_at,omitempty"`
}
